﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Web;
using System.Web.Http;

namespace Game.Controllers
{
    public class RegistrationController : ApiController
    {
        [HttpGet]
        public bool SendEmail(string name, string email)
        {
            MailMessage mail = new MailMessage("admin@cool-game.com", email);
            SmtpClient client = new SmtpClient();
            client.Port = 25;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential("valentin.ionev@gmail.com", "blackcat9803");
            client.Host = "smtp.gmail.com";
            mail.Subject = "Confirmation Email.";
            mail.Body = "Greetings " + name + "," + Environment.NewLine + "Thank you for your registration. Please confirm your email by contacting us." + Environment.NewLine + Environment.NewLine + "If you have any issues, please contact support@battleoftitans.com." + Environment.NewLine + Environment.NewLine + "Regards," + Environment.NewLine +  "Battle of Titans Admin Staff";
            client.EnableSsl = true;
            client.Send(mail);
            return true;
        }
        
    }
}